package util;

import java.util.Date;

import com.jfinal.plugin.activerecord.Db;
import com.jfinal.plugin.activerecord.Model;
import com.jfinal.plugin.activerecord.Record;

public class ModelUtils {
	public static void fillForSave(Model m){
		//m.set("id", CommonUtil.getUUID());
		m.set("createDate", new Date());
		m.set("modifyDate", new Date());
	}
	
	public static void fillForUpdate(Model m){
		m.set("modifyDate", new Date());
	}

	public static void fillForUpdate(Model m,String id){
		m.set(id, new Date());
	}

	public  static  void fillUUID(Model m,String id){
		Record r = Db.findFirst("select UUID_SHORT() as uuid");
		m.set(id,r.get("uuid"));
	}
}
